Skip to content

Conversation

@GittyHarsha
Copy link

API to configure Enhanced Security Mode states

@GittyHarsha
Copy link
Author

@microsoft-github-policy-service agree company="Microsoft"

@GittyHarsha GittyHarsha requested a review from shrinaths October 30, 2025 09:13
![image](https://github.com/MicrosoftEdge/WebView2Feedback/assets/82386753/35977716-e46c-4257-82da-906b0c6f833e)

Unlike Microsoft Edge, WebView2 does not support the heuristic-based "Balanced"
level; only Off and Strict are available.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a possibility that such a mixed mode could arrive in the future? E.g. SetEnhancedSecurityModeExemptDomains("contoso.com") which lets you say "Turn on ESM for all non-contoso sites"?

Could be

enum CoreWebView2EnhancedSecurityMode
{
    Off,
    On,
   // future: OnForUntrustedDomains
}

runtimeclass CoreWebView2Profile
{
    CoreWebView2EnhancedSecurityMode EnhancedSecurityMode { get; set; }
}

?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now, ESM does two things. Suppose that we later think of a third thing. Would we

  1. Add it to the things you get when you enable ESM
  2. Make it another tier of ESM that apps have to opt into [IsEnhancedSecurityMode =very true]
  3. Make it an entirely separate feature (Super-Secure Mode) that apps have to opt into separately from ESM

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My expectation based on reading "enabling additional OS protections" is that a third thing could already quietly light up when ESM is on.

If we create this as an enum to make it extensible, should probably be { Off, Strict } (instead of "On") since 3rd+ values (e.g. "Balanced" being supported) would be different flavors of "on".

Copy link
Author

@GittyHarsha GittyHarsha Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, in coming APIs we will add support to exempt origins, we can have something like SetESMBypassList: to always not apply enhanced security and SetESMEnforceList: to always apply enhanced security for the origins in the list, irrespective of the ESM level for that profile.

We’re looking to introduce a unified API later for origin-level configurability, since there are several features like tracking prevention, SmartScreen, ESM, and others with origin exemptions capability.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it makes sense to have off and strict enums instead of off and on. We may support balanced mode in future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants